package com.situ.water_read.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.situ.water_read.mapper.RdReadMapper;
import com.situ.water_read.pojo.RdChangevalue;
import com.situ.water_read.mapper.RdChangevalueMapper;
import com.situ.water_read.pojo.RdRead;
import com.situ.water_read.service.RdChangevalueService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Angel
 * @since 2020-12-01
 */
@Service
public class RdChangevalueServiceImpl extends ServiceImpl<RdChangevalueMapper, RdChangevalue> implements RdChangevalueService {
    @Autowired
    private RdChangevalueMapper mapper;
    @Autowired
    private RdReadMapper readMapper;
    @Override
    public void updatePre(Integer rid, Integer preValue2) {
        RdRead read=new RdRead();
        read.setId(rid);
        read.setPreValue(preValue2);
        readMapper.updateById(read);
    }

    @Override
    public int addChangePreValue(RdChangevalue value,Integer id) {
        Date date=new Date();
        value.setDatee(date);
        value.setEmpID(id);
        return mapper.insert(value);
    }

    @Override
    public IPage<Map> querypre(Page<Map> page, QueryWrapper wrapper) {
        return mapper.querypre(page,wrapper);
    }

}
